package com.eling.elcms.travel.model;

import com.eling.elcms.basedoc.model.Room;
import com.eling.elcms.core.dao.annotation.Between;
import com.eling.elcms.core.dao.annotation.In;
import com.eling.elcms.core.model.BaseModel;
import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.IndexedEmbedded;

import javax.persistence.*;
import java.util.Date;

/**
 * 房间占用详细
 * 
 * @author zhoulin
 *
 */
@Entity
@Table(name = "travel_roomoccupancy")
@Indexed
public class RoomOccupancy extends BaseModel {

	private static final long serialVersionUID = -6091069501591691653L;

	@Id
	@In
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@DocumentId
	private Long pkRoomOccupancy;

	/** 房间 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "pkRoom")
	@IndexedEmbedded(depth = 1)
	private Room room;

	/** 老人团 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "pkPlanItemGroup")
	@IndexedEmbedded(depth = 1)
	private PlanItemGroup planItemGroup;

	/** 散客团 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "pkNonMemberGroup")
	@IndexedEmbedded(depth = 1)
	private NonMemberGroup nonMemberGroup;

	/** 占用日期 */
	@Column
	@Field
	@Between
	private Date occupyDate;

	@Version
	private Integer version;

	public Long getPkRoomOccupancy() {
		return pkRoomOccupancy;
	}

	public void setPkRoomOccupancy(Long pkRoomOccupancy) {
		this.pkRoomOccupancy = pkRoomOccupancy;
	}

	public Room getRoom() {
		return room;
	}

	public void setRoom(Room room) {
		this.room = room;
	}

	public PlanItemGroup getPlanItemGroup() {
		return planItemGroup;
	}

	public void setPlanItemGroup(PlanItemGroup planItemGroup) {
		this.planItemGroup = planItemGroup;
	}

	public NonMemberGroup getNonMemberGroup() {
		return nonMemberGroup;
	}

	public void setNonMemberGroup(NonMemberGroup nonMemberGroup) {
		this.nonMemberGroup = nonMemberGroup;
	}

	public Date getOccupyDate() {
		return occupyDate;
	}

	public void setOccupyDate(Date occupyDate) {
		this.occupyDate = occupyDate;
	}

	public Integer getVersion() {
		return version;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}

}
